package org.darkforest.vo;

import org.darkforest.common.util.SystemConstant;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * Created by valentina on 15/5/24.
 * 支付页面所需信息
 */
public class PayInfoVo {
    private Integer orderId;
    private String orderSn;
    private BigDecimal total_fee;
    private String pay_code;
    private String memberName;                  //暂存用户信息
    private BigDecimal memberPredeposit;
    private Integer buyerId;
    private String payNo;
    private int payMethod;                      //支付方式 -1:余额不足 1:全额支付 2:折扣支付
    private  BigDecimal pdAmount;

    /**
     * 根据账户余额判断支付方式
     * @return
     */
    public String getPayMethodInfo(){
        String res ="";
        //账户余额不足全款
        if( memberPredeposit.compareTo(total_fee)==-1){
            this.payMethod = -1;
            res = "￥"+ memberPredeposit;
        }
        if( memberPredeposit.compareTo(total_fee)>=0){
            //全额支付足够
            this.payMethod = 1;
            res = "￥"+total_fee;
        }
        return res;
    }

    public BigDecimal getPdAmount() {
        return pdAmount;
    }

    public void setPdAmount(BigDecimal pdAmount) {
        this.pdAmount = pdAmount;
    }

    /**
     * 获取除账户余额之外的应支付现金
     * @return
     */
    public BigDecimal getPayCash(){
        BigDecimal res = new BigDecimal(0);
        if (payMethod==-1){
            res = total_fee.subtract(memberPredeposit);
        }
        return res;
    }

    public BigDecimal getPayCashLocal(){
        return getPayCash();
    }



    public int getPayMethod() {
        getPayMethodInfo();
        return payMethod;
    }

    public Integer getBuyerId() {
        return buyerId;
    }

    public void setBuyerId(Integer buyerId) {
        this.buyerId = buyerId;
    }

    public Integer getOrderId() {
        return orderId;
    }

    public void setOrderId(Integer orderId) {
        this.orderId = orderId;
    }

    public String getOrderSn() {
        return orderSn;
    }

    public void setOrderSn(String orderSn) {
        this.orderSn = orderSn;
    }

    public BigDecimal getTotal_fee() {
        return total_fee;
    }

    public void setTotal_fee(BigDecimal total_fee) {
        this.total_fee = total_fee;
    }

    public String getPay_code() {
        return pay_code;
    }

    public void setPay_code(String pay_code) {
        this.pay_code = pay_code;
    }

    public String getMemberName() {
        return memberName;
    }

    public void setMemberName(String memberName) {
        this.memberName = memberName;
    }

    public BigDecimal getMemberPredeposit() {
        return memberPredeposit;
    }

    public void setMemberPredeposit(BigDecimal memberPredeposit) {
        this.memberPredeposit = memberPredeposit;
    }

    public String getPayNo() {
        return payNo;
    }

    public void setPayNo(String payNo) {
        this.payNo = payNo;
    }
}
